//
//  nominateFriendController.m
//  PaiQuan
//
//  Created by Mac on 16/7/12.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "nominateFriendController.h"
#import "alertview.h"
#import "PersonalViewController.h"

@interface nominateFriendController ()<Customaltviewdelete>
@property(nonatomic,strong)UIView *coverView;
@end

@implementation nominateFriendController

- (void)viewDidLoad {
    [super viewDidLoad];
    [super viewDidLoad];
    
    //nav
    self.tableView.backgroundColor = PQ_COLOR_LightGray;
    self.titleView.title = @"发送到";
    [self.titleView.rightBtn setTitle:@"取消" forState:UIControlStateNormal];
    [self.titleView.rightBtn setTitleColor:PQ_COLOR_YELLOW forState:UIControlStateNormal];
    [self.titleView.rightBtn addTarget:self action:@selector(cancelBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    
    //搜索框
    UIView *headerView = [[UIView alloc] init];
    headerView.frame = CGRectMake(0, 0, ScreenW, RATIO(108));
    headerView.backgroundColor = PQ_COLOR_LightGray;
    
    UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(RATIO(24), RATIO(18), RATIO(702), RATIO(60))];
    searchBar.backgroundColor =[UIColor whiteColor ];
    
    
    searchBar.backgroundImage = [UIImage imageWithColor:[UIColor whiteColor] frame:searchBar.frame];
    searchBar.placeholder = @"搜索好友俱乐部";
    [headerView addSubview:searchBar];
    
    self.tableView.tableHeaderView = headerView;

    

  
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"id";
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
         cell.textLabel.text = @"穿越时空的奥特曼";
    }
    
    
    return cell;
    
}
-(void)cancelBtnDidClick{
    [self.navigationController popViewControllerAnimated:YES];
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UIWindow *windowView = [UIApplication sharedApplication].keyWindow;
    self.coverView = [[UIView alloc] init];
    self.coverView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7];
    self.coverView.frame = CGRectMake(0, 0, ScreenW, ScreenH);
    [windowView addSubview:self.coverView];
    
    
  

    
    alertview *artView = [[alertview alloc] init];
    artView.backgroundColor = [UIColor whiteColor];
    artView.layer.cornerRadius = 4;
    artView.layer.masksToBounds = YES;
    
    [artView altTitle:@"发送到 铁拳无敌 孙中山" ximg:PQIMG(@"03_heighted") NameTitle:@"隐匿偷窥者" addressTitle:@"温州" ];
    [self.coverView addSubview:artView];
    [artView makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(RATIO(540));
        make.height.equalTo(RATIO(344));
        make.centerX.centerY.equalTo(self.coverView);
    }];
    artView.deleta = self;
    [artView show];

    
}
#pragma mark --点击事件
-(void)alertview:(id)altview clickbuttonIndex:(NSInteger)index{
    if ((index = 1)) {
        [self.coverView removeFromSuperview];

    }else{
        [self.coverView removeFromSuperview];
        PersonalViewController * personalVC = [[PersonalViewController alloc] init];
               [self.navigationController popToViewController:personalVC animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
